#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QHash>

namespace Ui {
class MainWindow;
}

#ifndef UTF8
#define UTF8(x) QString::fromUtf8(x)
#endif

typedef int TimerId;

struct Status
{
    QString key;
    QString value;
};

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

public slots:
    void on_actStart_triggered();
    void on_actStop_triggered();

    void showMessage(QString message);
    void onUpdateFinished();
protected:
    void timerEvent(QTimerEvent * ev);
private:
    void stopTimer(TimerId & id);
    void log(QString text, bool brace = true);
    void onStatusTimerUpdate();
    void setTimer(TimerId & id, int interval);
    void makeCommand(QString command, QString slot);
    void FillTreeFromUpdate(QString fileInfo);

private:
    Ui::MainWindow *ui;
    TimerId _statusTimerId;
    QHash<QString, QString> _statuses;

};

#endif // MAINWINDOW_H
